﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Dia2Lib;

namespace Kokomo.Mirror.PeFormat.Symbols
{
	public class ModuleSymbol : Symbol
	{
		internal ModuleSymbol(
			IDiaSymbol symbol
			)
			: base(symbol)
		{
			this._compilands = new Lazy<IEnumerable<CompilandSymbol>>(() => this.Children.OfType<CompilandSymbol>());
			this._publicSymbols = new Lazy<IEnumerable<PublicSymbol>>(() => this.Children.OfType<PublicSymbol>());
		}

		/* DispID 75 */
		public uint Age { get { return this.DiaSymbol.age; } }
		/* DispID 43 */
		public Guid Guid { get { return this.DiaSymbol.guid; } }
		/* DispID 124 */
		public bool HasCTypes { get { return this.DiaSymbol.isCTypes != 0; } }
		/* DispID 125 */
		public bool IsStrippedOfPrivateSymbols { get { return this.DiaSymbol.isStripped != 0; } }
		/* DispID 88 */
		public MachineType MachineType { get { return (MachineType)this.DiaSymbol.machineType; } }
		/* DispID 76 */
		public uint Signature { get { return this.DiaSymbol.signature; } }
		/* DispID 44 */
		public string SymbolsFileName { get { return this.DiaSymbol.symbolsFileName; } }

		private Lazy<IEnumerable<CompilandSymbol>> _compilands;
		public IEnumerable<CompilandSymbol> Compilands
		{
			get { return this._compilands.Value; }
		}

		private Lazy<IEnumerable<PublicSymbol>> _publicSymbols;
		public IEnumerable<PublicSymbol> PublicSymbols
		{
			get { return this._publicSymbols.Value; }
		}
	}
}
